package ooday05;
/** static的测试类 */
public class StaticDemo {
    public static void main(String[] args) {
        StaticVar o1 = new StaticVar();
        o1.show();
        StaticVar o2 = new StaticVar();
        o2.show();
        StaticVar o3 = new StaticVar();
        o3.show();
        System.out.println(StaticVar.b);//静态变量通过类名打点访问对象
        System.out.println("----------------------");

        StaticBlock o4 = new StaticBlock();//加载类时自动执行静态块
        StaticBlock o5 = new StaticBlock();
        StaticBlock o6 = new StaticBlock();
        System.out.println("----------------------");

        StaticMethod o7 = new StaticMethod();//直接创建该类内的非静态方法的对象
        StaticMethod.test();//通过类名点来访问静态方法方法
    }
}
